<html>
    <meta charset="utf-8">
    <body>
        <h1>获取最新的access_token</h1>
<?php
$s = new SaeStorage();
$a=$s->read( 'token' , 'token.txt');

$appid = "wx873faf7512b61145";
$appsecret = "c1efbe6e57bd6cb78ad29ecec928295c";
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$jsoninfo = json_decode($output, true);
$access_token = $jsoninfo["access_token"];
    
//$s->upload( 'token' , 'token.txt' , '' );
//$s->write('token','token.txt',$access_token);
//echo $s->read( 'token' , 'token.txt') ;
//echo $s->getUrl( 'token' , 'token.txt') ;
$s->write('token','token.txt',$access_token);
echo "写入access_token";
?>
    </body>
    </html>